package com.phaeton.beemeup.entity;

import java.util.ArrayList;

import org.andengine.entity.scene.Scene;
import org.andengine.entity.shape.IAreaShape;
import org.andengine.input.touch.TouchEvent;
import org.andengine.opengl.texture.region.ITextureRegion;

import com.phaeton.beemeup.GameManager;
import com.phaeton.beemeup.constants.SceneConstants;

public class NewComb extends Cell {
	private BeeComb source;
	private GameManager mGameManager;
	private int col, row;

	public NewComb(BeeComb comb, int col, int row,
			ITextureRegion pTextureRegion,
			GameManager pGameManager) {
		super(col, row, pGameManager.getLevel().getCell(col, row).getX(), pGameManager.getLevel().getCell(col, row).getY(), pTextureRegion, pGameManager.getActivity().getVertexBufferObjectManager());
		mGameManager = pGameManager;
		source = comb;
		this.col = col;
		this.row = row;
	}
	
	@Override
	public boolean onAreaTouched(final TouchEvent pSceneTouchEvent, final float pTouchAreaLocalX, final float pTouchAreaLocalY) {
		if(pSceneTouchEvent.isActionDown()) {
			mGameManager.hideNewCombs();
			mGameManager.spawnBeeComb(col, row, 0);
			source.setHoney(source.getHoney() - 5);
			return true;
		}
		return false;						
	}
}
